﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="TagsInListItemStyle"
           TargetType="{x:Type ItemsControl}">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border Name="PART_Border"
                            Margin="4"
                            Background="{DynamicResource ForegroundBrush}"
                            Padding="2">
                        <TextBlock Foreground="{DynamicResource TextBrush}"
                                   Text="{Binding Name}" />
                    </Border>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsSelected,
                                                       RelativeSource={RelativeSource FindAncestor,
                                                                                      AncestorType={x:Type ListBoxItem}}}"
                                     Value="True">
                            <Setter TargetName="PART_Border" Property="Background" Value="{DynamicResource BackgroundBrush}" />
                        </DataTrigger>

                    </DataTemplate.Triggers>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>